The Application of Prolog to Structured Design

نویسندگان

  • T. H. Tse
  • Tsong Yueh Chen
  • F. T. Chan
  • Huo Yan Chen
  • H. L. Xie
چکیده

form suitable for the transform centre. An efferent stream, on the other hand, is a string of processes which convert output data from the transform centre into a more physical form suitable for output to the real world. We can know for sure that some nodes must belong to the transform centre. They satisfy either of the following conditions: (a) The node name contains a verb such as subtract which would alter the values of input data items. (b) Statements in the mini-specification of the node contain verbs which would alter the values of input data items. We define the Core transform centre as the minimal sub-data-flow-diagram containing these nodes. We also know for sure that some nodes must belong to the afferent streams. As recommended by standard guidelines, we follow each input stream and identify those nodes whose input and output data names are similar except a qualifier. Examples are order and valid order, or formatted debit and confirmed debit. We define Core afferent as the minimal afferent streams containing these nodes. The nodes between Core afferent and Core transform centre, not identified by the above criteria, can possibly be regarded either as part of the afferent streams or part of the transform centre. Our system would initially treat all of them as part of the afferent streams. The treatment on Core efferent and that on the nodes between Core efferent and Core transform centre are similar. Structure charts can then be constructed and evaluated, such as by promoting a boss or hiring a boss, as described in detail in Reference 13. If, however, the structure charts thus constructed are unacceptable, the system will backtrack automatically and reduce the afferent and efferent streams. This will be repeated until the result is acceptable, or until the afferent and efferent streams cannot be reduced further. The following, then, is a program for transform analysis: transform analysis(Node list, Root) :– split(Node list, Transform centre, Afferent, Efferent), convert(Root, Transform centre, Afferent, Efferent). The predicate split divides a given set of processes in a data flow diagram into the transform centre and the sets of afferent and efferent processes as described. The predicate convert transforms them into sub-structure-charts and hangs them under the Root module. These predicates are defined as follows: split(Node list, Transform centre, Afferent, Efferent) :– core transform of(Node list, Core transform centre), core afferent of(Node list, Core afferent), semi afferent of(Node list, Core transform centre, Core afferent, Semi afferent), semi afferent subpaths of(Semi afferent, Core transform centre, Semi afferent subpaths), append(Semi afferent subpaths, Core transform centre, Temp transform centre), subtract(Semi afferent, Semi afferent subpaths, 668 t. h. tse et al. Remaining semi afferent), append(Core afferent, Remaining semi afferent, Afferent), core efferent of(Node list, Core efferent), semi efferent of(Node list, Core transform centre, Core efferent, Semi efferent), semi efferent subpaths of(Semi efferent, Core transform centre, Semi efferent subpaths), append(Temp transform centre, Semi efferent subpaths, Transform centre), subtract(Semi efferent, Semi efferent subpaths, Remaining semi efferent), append(Remaining semi efferent, Core efferent, Efferent). convert(Root, Transform centre, Afferent, Efferent) :– retractable assertz(sc module(Root)), convert afferent(Afferent, Root), convert transform centre(Transform centre, Root), convert efferent(Efferent, Root). convert transform centre(Transform centre, Root) :– hire a boss(Transform centre, Root) ; promote a boss(Transform centre, Root). where the predicate retractable assertz(clause) inserts the clause into the Prolog database in forward execution, but removes it in the case of backtracking. Transaction analysis Transaction analysis consists of three steps: 1. Find each transaction centre by locating the respective first node and all its subsequent branches. 2. Reduce each of them into a single node for the ease of transform analysis. 3. Re-expand the nodes afterwards. If there is more than one transaction centre in a given data flow diagram, transaction analysis will be executed recursively. The first node in a transaction centre is a process which inspects the type of each transaction entering the system and routes it to its corresponding branch for processing. We locate this first node (which we shall call Milestone) from the set of processes in a data flow diagram using the following predicate: is milestone(Node list, Milestone) :– member(Milestone, Node list), dfd couple( , Input, Milestone), setof(Data, N̂ dfd couple(Milestone, Data, N), Data list), is transact data(Input, Data list), mutually exclusive types(Data list). 669 application of prolog to structured design is transact data( , [] ). is transact data(Input, [Data u Other data]) :– is part of(Data, Input), is transact data(Input, Other data). where the predicate is part of(Data, Input) holds if every component of Data is a component of Input, and mutually exclusive types(Data list) holds if there is a common component X in each item of data in Data list such that all the Xs are different. This example illustrates the advantage of using a declarative programming language to help automating structured design. We need only to declare the characteristics of Milestone. It is not necessary to specify the procedure for searching all modules. The is milestone predicate will trigger the intrinsic backtracking mechanism and find every Milestone. The declarative characteristic of Prolog is useful also in many other parts of the system. The predicate for transaction analysis may then be written as follows: transact analysis(Node list, Temp node list, New node list) :– is milestone(Node list, Milestone), !, findall(Transact branch, ( dfd couple(Milestone, , Second node), transact branch of(Node list, Milestone, Second node, Transact branch) ), Transact branches), append([Milestone], Transact branches, Transact centre), assertz(is transact centre(Transact centre)), reduce(Node list, Milestone, Transact centre, Temp node list), transact analysis(Temp node list, Temp node list2, New node list) ; New node list 5 Node list. Here the predicate reduce replaces the entire Transact centre by a single node. If the name of the original Milestone is x, then the single node will be given a name of do x. The clause is transact centre(Transact centre) is a fact inserted into the Prolog database to save the details of the hidden transaction centre for use in the predicate expand transact centres below. If there is more than one transaction centre in a given data flow diagram, there will be more than one fact is transact centre(Transact centre) inserted. The predicate fail in expand transact centres will cause backtracking to take place and re-expand further Transact centres thus saved. expand transact centres :– is transact centre([Milestone u Transact branches]), expand branches(Milestone, Transact branches), concat(‘do ’, Milestone, New milestone), setof(Node, 670 t. h. tse et al. D̂ sc couple(New milestone, D, Node), Node list), assertz(sc structure(New milestone, selection, Node list)), fail ; abolish(is transact centre / 1). expand branches( , [ ]). expand branches(Milestone, [Transact branch u Other branches]) :– concat(‘do ’, Milestone, New milestone), Transact branch 5 [Second node u Other nodes], transform analysis(Other nodes, Second node), dfd couple(Milestone, Input, Second node), retractable assertz(sc couple(New milestone, Input, Second node)), findall(Output, ( last node of(Transact branch, Second node, Last node), dfd couple(Last node, Output, ) ), Output list), retractable assertz(sc couple(Second node, Output list, New milestone)), expand branches(Milestone, Other branches). EVALUATION OF STRUCTURE CHARTS Some of the structure charts produced by the predicates described in the last section may be reasonably acceptable by users, but others may not be worth considering. We must evaluate the structure charts according to some established guidelines,which may include coupling, cohesion, fan-out, fan-in consistency, tramp data, factoring, decision-splitting, morphology, and initializing and terminating modules. The first four are the most important and have been used in our system. Since Prolog programs are declarative in nature, any further expertise in evaluation, as long as it does not contradict existing heuristics, can be incorporated incrementally. The predicate for evaluation is specified simply as follows: evaluate :– globally acceptable coupling, globally acceptable cohesion, globally acceptable fan outs, globally consistent fan ins. Details of each predicate called will be explained in the subsequent subsections. 671 application of prolog to structured design

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

The Application of Prolog to Structured Design 1

SUMMARY In this paper, we investigate into the feasibility of applying logic programming to structured design. We propose to use Prolog as a common machinery for the representation of various structured tools. We illustrate through examples how to produce structure charts from data flow diagrams, and evaluate them according to commonly recommended design guidelines. If the structure charts prod...

متن کامل

Syntactic integration of external languages in Prolog

Todays applications are typically programmed in multiple languages, using SQL to access databases, JavaScript to make the (web-based) user interface interactive, etc. Prolog can cooperate to this orchestra using two views: as a logic server component or as ‘glue’. In this article we concentrate on the ‘glue’ view, which implies that we must be able to ‘talk’ the language of other components. In...

متن کامل

Using SQL with Prolog to improve performance with large databases

This article describes how the performance of certain Prolog programs can be improved by storing large lists of facts in an SQL database rather than as Prolog facts. In experiments that will be described, the speed improvements ranged from negligible to a factor of over 200. This improvement comes about because SQL servers are strongly optimized for searching large, flat tables. However, modern...

متن کامل

Application of quality function deployment (QFD) to improve product design: The school furniture case

Today Quality Function Deployment (QFD) is a powerful development method whit a wide range of applications to translate customers’ needs into technical requirements for achieving customer satisfaction. The current study demonstrated a QFD analysis to improve school furniture design in Tehran as the baseline of Iran. Accordingly, we extended the widely used QFD method into a complex set of custo...

متن کامل

Applying Techniques to Skeletons

This paper concerns our research on developing a theory and methodology appropriate for systematically building complicated Prolog programs. Programs are constructed procedurally from standard components. We identify skeletons, basic Prolog programs with a well-understood control ow, and techniques, standard Prolog programming practices, as basic components. Applying a technique to a skeleton c...

متن کامل

An Application Specific Shell for Design Rule Checking

This paper presents a tool, which can be described as an expert system shell specialized for the application domain of checking electronic hardware designs with respect to a set of design rules. The shell has been used successfully to represent various kinds of design rules and to check real integrated circuit designs. We will first discuss concept of application specific shell in general. Then...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

عنوان ژورنال:
  • Softw., Pract. Exper.

دوره 24  شماره 

صفحات  -

تاریخ انتشار 1994